#!/bin/sh

# in some situations (emmc, ssd...) emulationstation can load really fast,
# so wait for splash to finish before launching ES

wait_splash_end() {
	mp_pid=$(pgrep -f S06splash)
	while kill -0 $mp_pid 2>/dev/null; do
		sleep 1
	done
}

case "$1" in
	start)
		wait_splash_end
		;;
	*)
		echo "Usage: $0 {start}"
		exit 1
		;;
esac

exit 0
